﻿package anshe.widget
{
	import anshe.struct.RoomInfo;
	import anshe.struct.UserInfo;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.dstart.object.debug.FDebug;
	import org.dstart.object.debug.event.DebugEvent;

	public dynamic class AnsheSprite extends Sprite
	{
		public var fDebug:Object;		//	调试框对象（正式发布时会去掉该对象）
		
		public var gameArray:Array;		//	游戏程序列表（每个对象都是一个 String 参数）
		
		public var myInfo:UserInfo;		//	当前玩家的基本信息
		public var myRoom:RoomInfo;		//	当前玩家所在 IMVU 房间的基本信息
		
		public function AnsheSprite(isOpenDebug:Boolean = true)
		{
			this.gameArray = new Array();
			this.myInfo = new UserInfo();
			this.myRoom = new RoomInfo();
						
			//**
			if(isOpenDebug)
			{
				DebugEvent.stageWidth = 600;
				DebugEvent.stageHeight = 400;
				
				fDebug = new FDebug();
			}
			else
			{
				fDebug = new Object();
			}
			//**/
			this.addEventListener(Event.ADDED_TO_STAGE, onShowInit);
		}		
		
		private function onShowInit(e:Event):void
		{
			if(fDebug is DisplayObject)
			{
				this.stage.addChild(fDebug as DisplayObject);
			}
		}
	}
}